﻿import pygame
from pygame.locals import *

import modelagem.primitives
from constants import *
from entities import *
from modelagem.widgets import *

class InitialScene(modelagem.primitives.Scene):
	
	def __init__(self):
		backSurface = pygame.Surface( (730,520) )
		backSurface = backSurface.convert()
		backSurface.fill((255, 255, 255))
		
		objects = []
		
		self._create_scene(objects)	
	
		super(InitialScene,self).__init__( backSurface,objects)
		
	def loop_routine(self):
		pass
		
	def _create_scene(self,objects):
		plot = self.configurar_plotador()	
		guiControls = InterfaceControlsEntitie("guiControls",plot)
		
		btnLimpar = Button("btnLimpar",self.botao_limpar_click)
		btnLimpar.label = "Limpar Graficos"
		btnLimpar.rect.x = 520
		btnLimpar.rect.y = 300
		btnLimpar.pack()
						
		objects.append( plot )
		objects.append( guiControls )
		objects.append( btnLimpar )
		
	def botao_limpar_click(self,go):		
		self.plot.limpar_conjuntos()
		self.plot.limpar()
		
	def configurar_plotador(self):	
		plot = PlotadorEntitie("plot",500,500)
		plot.gerarPlano(-1,50,-1,50)
		
		plot.mostrar_valores = False
		plot.mostrar_ponto_atual = False
		
		plot.setLabelX("x")
		plot.setLabelY("y")
		
		plot.setModo(PONTO)	
		
		return plot			